<?php


class Photo extends Entity { use PhotoView;
	
	//Nom de la table
	protected static $sql_table='photo';
	//Colonne utilisée comme identifiant
	protected static $sql_id='PHOT_NUMID';

	//Liste des colonnes de la table
	protected $PHOT_NUMID;
	protected $PHOT_LIEN;
	protected $PHOT_RATIO;
	protected $FILM_NUMID;
	
	
	
	public function delete(){
            $retour=parent::delete();
	    FileSystem::deleteFile($this->PHOT_LIEN);
	    return $retour;
	}
        
        
        
	public function populate($values){
            parent::populate($values);

            $infosImage=Image::check('PHOT_LIEN');
            if(is_array($infosImage)){
		if($this->PHOT_LIEN) FileSystem::deleteFile($this->PHOT_LIEN);
                $this->PHOT_LIEN=$infosImage['lien'];
                $this->PHOT_RATIO=$infosImage['ratio'];
            }
        }

}


?>